.. _`Sort rows in Table`: .. _`org.sysess.sympathy.data.table.sorttable`: Sort rows in Table `````````````````` .. image:: sort_table_rows.svg :width: 48 Sort rows in Table by selected column Documentation ::::::::::::: Sort the rows of a table according to a sort column. The rows in the Tables are sorted by the selected *Sort column*. If *Sort order* is "Standard" numbers will be sorted increasingly, strings will be sorted alphabetically etc. If it is instead "Reverse" the order is instead reversed. Sorting by multiple rows ======================== The sorting algorithm used is stable, meaning that if two or more rows have the same value in the *Sort column* they will keep the same relative order as in the input. This can be used to sort the table by multiple columns. If you want to sort by multiple columns you can use multple sorting nodes in series. For example if you have the following table ad want to sort the table such that high priority tasks come first, and tasks with equal priority are sorted by lowest time needed: +----------------+----------+-------------+ | Task | Priority | Time needed | +================+==========+=============+ | Do dishes | A | 30 | +----------------+----------+-------------+ | Mop floors | C | 45 | +----------------+----------+-------------+ | Clean windows | C | 30 | +----------------+----------+-------------+ | Take out trash | A | 5 | +----------------+----------+-------------+ | Buy groceries | B | 60 | +----------------+----------+-------------+ then first use a Sort rows in Table node to sort the rows by increasing time, then use a second Sort rows in Table node to sort the rows by highest priority. The result would then be: +----------------+----------+-------------+ | Task | Priority | Time needed | +================+==========+=============+ | Take out trash | A | 5 | +----------------+----------+-------------+ | Do dishes | A | 30 | +----------------+----------+-------------+ | Buy groceries | B | 60 | +----------------+----------+-------------+ | Clean windows | C | 30 | +----------------+----------+-------------+ | Mop floors | C | 45 | +----------------+----------+-------------+ Definition :::::::::: Input ports =========== **Input** table Input Output ports ============ **Output** table Input Configuration ============= **Sort column** (column) Column to sort **Sort order** (sort_order) Sort order Examples ======== * :download:`SortRowsInTable.syx ` * :download:`FigureSortLegend.syx ` Implementation ============== .. automodule:: node_table_sort :noindex: .. class:: SortRowsTable :noindex: